{extend name="default/base/base_member" /}
{block name="member_main"}


<div class="dsm-flow-layout">
            <div class="dsm-flow-container">
                <div class="title">
                    <h3>{$Think.lang.application_refund_service_type}：</h3>
                   <div class="refund-type-box">
                        <label><input type="radio" name="refund-type" value="1" checked   /><span>{$Think.lang.refund_only}</span></label>
                        <label><input type="radio" name="refund-type" value="2"  /><span>{$Think.lang.refund_returns}</span></label>
                    </div>
                </div>
                <div class="alert">
                    <h4>{$Think.lang.operating_hints}：</h4>
                    <ul>
                        <li>{$Think.lang.refund_instructions1|raw}</li>
                        <li>{$Think.lang.refund_instructions2|raw}</li>
                        <li>3. {$Think.lang.refund_instructions3|raw}</li>
                        <li>4. {$Think.lang.refund_instructions4|raw}</li>
                    </ul>
                </div>
                <div id="saleRefund" show_id="1">
                    <div class="dsm-flow-step">
                        <dl class="step-first current">
                            <dt>{$Think.lang.buyer_application_refund}</dt>
                            <dd class="bg"></dd>
                        </dl>
                        <dl class="">
                            <dt>{$Think.lang.platform_review}<dt>
                            <dd class="bg"> </dd>
                        </dl>
                    </div>
                    <div class="dsm-default-form">
                        <form id="post_form1" enctype="multipart/form-data" method="post" action="{:url('Memberrefund/add_refund',['order_id'=>$order.order_id,'goods_id'=>$goods.rec_id])}">
                            <input type="hidden" name="refund_type" value="1" />
                            <h3>{$Think.lang.please_fill_refund_application}</h3>
                            <dl>
                                <dt><i class="required">*</i>{$Think.lang.refund_buyer_message}：</dt>
                                <dd>
                                    <select class="select w150" name="reason_id">
                                        <option value="">{$Think.lang.please_select_refund_reason}</option>
                                        {notempty name="$reason_list"}
                                        {foreach name="reason_list" item="val" key="key" }
                                        <option value="{$val.reason_id}">{$val.reason_info}</option>
                                        {/foreach}
                                        {/notempty}
                                        <option value="0">{$Think.lang.ds_other}</option>
                                    </select>
                                    <span class="error"></span> </dd>
                            </dl>
                            <dl>
                                <dt><i class="required">*</i>{$Think.lang.refund_amount_required}：</dt>
                                <dd>
                                    <input type="text" class="text w50" name="refund_amount" value="{$goods.goods_pay_price}" /><em class="add-on"><i class="iconfont">&#xe65c;</i></em>（{$Think.lang.refund_max} <strong class="green" title="{$Think.lang.system_calculated_according_order}">{$goods.goods_pay_price}</strong> {$Think.lang.ds_yuan}） <span class="error"></span>
                                    <p class="hint">{$Think.lang.cannot_exceed_refundable_amount}</p>
                                </dd>
                            </dl>
                            <dl>
                                <dt><i class="required">*</i>{$Think.lang.refund_instructions}：</dt>
                                <dd>
                                    <textarea name="buyer_message" rows="3" class="textarea w400"></textarea>
                                    <br />
                                    <span class="error"></span> </dd>
                            </dl>
                            <dl>
                                <dt>{$Think.lang.upload_voucher}：</dt>
                                <dd>
                                    <p>
                                        <input name="refund_pic1" type="file" />
                                        <span class="error"></span> </p>
                                    <p>
                                        <input name="refund_pic2" type="file" />
                                        <span class="error"></span> </p>
                                    <p>
                                        <input name="refund_pic3" type="file" />
                                        <span class="error"></span> </p>
                                </dd>
                            </dl>
                            <div class="bottom">
                                <input type="submit" class="submit" value="{$Think.lang.submit_confirmation}" />
                                <a href="javascript:history.go(-1);" class="dsm-btn ml10">{$Think.lang.cancel_return}</a>
                            </div>
                        </form>
                    </div>
                </div>
                <div id="saleRefundreturn" show_id="2" style="display: none;">
                    <div class="dsm-flow-step">
                        <dl class="step-first current">
                            <dt>{$Think.lang.uyer_applies_return}</dt>
                            <dd class="bg"></dd>
                        </dl>
                        <dl class="">
                            <dt>{$Think.lang.business_processing_return_applications}</dt>
                            <dd class="bg"> </dd>
                        </dl>
                        <dl class="">
                            <dt>{$Think.lang.buyers_return_business}</dt>
                            <dd class="bg"> </dd>
                        </dl>
                        <dl class="">
                            <dt>{$Think.lang.confirm_goods}</dt>
                            <dd class="bg"> </dd>
                        </dl>
                    </div>
                    <div class=" dsm-default-form">
                        <div id="warning"></div>
                        <form id="post_form2" method="post" enctype="multipart/form-data" action="{:url('Memberrefund/add_refund',['order_id'=>$order.order_id,'goods_id'=>$goods.rec_id])}">
                            <input type="hidden" name="refund_type" value="2" />
                            <h3>{$Think.lang.fill_return_refund_application}</h3>
                            <dl>
                                <dt><i class="required">*</i>{$Think.lang.reason_return_refund}：</dt>
                                <dd>
                                    <select class="select w150" name="reason_id">
                                        <option value="">{$Think.lang.please_select_refund_reason}</option>
                                        {notempty name="reason_list"}
                                        {foreach name="reason_list" item="val" key="key" }
                                        <option value="{$val.reason_id}">{$val.reason_info}</option>
                                        {/foreach}
                                        {/notempty}
                                        <option value="0">{$Think.lang.ds_other}</option>
                                    </select>
                                    <span class="error"></span> </dd>
                            </dl>
                            <dl>
                                <dt><i class="required">*</i>{$Think.lang.refund_order_refund}{$Think.lang.ds_colon}</dt>
                                <dd>
                                    <input type="text" class="text w50" name="refund_amount" value="{$goods.goods_pay_price}" />
                                    <em class="add-on"><i class="iconfont">&#xe65c;</i></em> （{$Think.lang.refund_max} <strong class="green" title="{$Think.lang.system_calculated_according_order}">{$goods.goods_pay_price}</strong> {$Think.lang.ds_yuan}） <span class="error"></span>
                                    <p class="hint">{$Think.lang.cannot_exceed_refundable_amount}</p>
                                </dd>
                            </dl>
                            <dl>
                                <dt><i class="required">*</i>{$Think.lang.return_order_return}{$Think.lang.ds_colon}</dt>
                                <dd>
                                    <input type="text" class="text w50" name="goods_num" value="{$goods.goods_num}" />
                                    <span class="error"></span> </dd>
                            </dl>
                            <dl>
                                <dt><i class="required">*</i>{$Think.lang.refund_instructions}：</dt>
                                <dd>
                                    <textarea name="buyer_message" rows="3" class="textarea w400"></textarea>
                                    <br />
                                    <span class="error"></span> </dd>
                            </dl>
                            <dl>
                                <dt>{$Think.lang.upload_voucher}：</dt>
                                <dd>
                                    <p>
                                        <input name="refund_pic1" type="file" />
                                        <span class="error"></span> </p>
                                    <p>
                                        <input name="refund_pic2" type="file" />
                                        <span class="error"></span> </p>
                                    <p>
                                        <input name="refund_pic3" type="file" />
                                        <span class="error"></span> </p>
                                </dd>
                            </dl>
                            <div class="bottom">
                                <input type="submit" class="submit" value="{$Think.lang.submit_confirmation}" />
                                <a href="javascript:history.go(-1);" class="dsm-btn ml10">{$Think.lang.cancel_return}</a>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
            {include file="default/member/memberrefund/member_refund_right" /}
        </div>



<script type="text/javascript">
    
$(function(){
    $('input[name="refund-type"]').click(function(){
           var refundtype = $('input[name="refund-type"]:checked').val(); 
           $("div[show_id]").hide();
           $("div[show_id='"+refundtype+"']").show();
    });
    $('#post_form1').validate({
	errorPlacement: function(error, element){
		error.appendTo(element.nextAll('span.error'));
        },
	submitHandler:function(form){
        $('#post_form1').submit();
	},
        rules : {
            reason_id : {
                required   : true
            },
            refund_amount : {
                required   : true,
                number   : true,
                min:0.01,
                max:{$goods.goods_pay_price}
            },
            buyer_message : {
                required   : true
            }
        },
        messages : {
            reason_id  : {
                required  : '<i class="iconfont">&#xe64c;</i>{$Think.lang.please_select_refund_reason}'
            },
            refund_amount  : {
                required  : '<i class="iconfont">&#xe64c;</i> {$Think.lang.refund_pay_refund}{$goods.goods_pay_price}',
                number   : '<i class="iconfont">&#xe64c;</i> {$Think.lang.refund_pay_refund}{$goods.goods_pay_price}',
                min   : '<i class="iconfont">&#xe64c;</i>{$Think.lang.refund_pay_min} 0.01',
	            max   : '<i class="iconfont">&#xe64c;</i>{$Think.lang.refund_pay_refund} {$goods.goods_pay_price}'
            },
            buyer_message  : {
                required   : '<i class="iconfont">&#xe64c;</i>{$Think.lang.please_fill_refund_instructions}'
            }
        }
    });
    $('#post_form2').validate({
		errorPlacement: function(error, element){
			error.appendTo(element.nextAll('span.error'));
        },
		submitHandler:function(form){
            $('#post_form2').submit();
		},
        rules : {
            reason_id : {
                required   : true
            },
            refund_amount : {
                required   : true,
                number   : true,
                min:0.01,
                max:{$goods.goods_pay_price}
            },
            goods_num : {
                required   : true,
                digits   : true,
                min:1,
                max:{$goods.goods_num}
            },
            buyer_message : {
                required   : true
            }
        },
        messages : {
            reason_id  : {
                required  : '<i class="iconfont">&#xe64c;</i>{$Think.lang.please_select_refund_reason}'
            },
            refund_amount  : {
                required  : '<i class="iconfont">&#xe64c;</i> {$Think.lang.refund_pay_refund}{$goods.goods_pay_price}',
                number   : '<i class="iconfont">&#xe64c;</i> {$Think.lang.refund_pay_refund}{$goods.goods_pay_price}',
                min   : '<i class="iconfont">&#xe64c;</i>{$Think.lang.refund_pay_min} 0.01',
	            max   : '<i class="iconfont">&#xe64c;</i> {$Think.lang.refund_pay_refund}{$goods.goods_pay_price}'
            },
            goods_num  : {
                required  : '<i class="iconfont">&#xe64c;</i> {$Think.lang.return_add_return}{$goods.goods_num}',
                digits   : '<i class="iconfont">&#xe64c;</i> {$Think.lang.return_add_return}{$goods.goods_num}',
                min   : '<i class="iconfont">&#xe64c;</i>{$Think.lang.return_number_min} 1',
	            max   : '<i class="iconfont">&#xe64c;</i>{$Think.lang.return_number_max} {$goods.goods_num}'
            },
            buyer_message  : {
                required   : '<i class="iconfont">&#xe64c;</i>{$Think.lang.fill_return_refund_instructions}'
            }
        }
    });
});
</script>






{/block}